<?php
/**
 * Created by PhpStorm.
 * User: Mr.liu
 * Date: 2021/12/16
 * Time: 21:16
 * Motto: 今日事，今日毕
 */
include_once '../tools/DbTools.php';
session_start();

include_once '../common/common.php';
$isLogin = getLoginStatus();
if(!$isLogin){
    echo '尚未登入，<a href="loginUi.php">请先登入</a>';die;
}
//到这里，表示已经登入
$token = $_COOKIE['Token'];
$userInfo = $_SESSION[$token];
//本卡号CardId;
$CardId=$userInfo['CardId'];
$CardNo =$userInfo['username'];
$AccountId=$userInfo['AccountId'];
DbTools::init();
//
//$sql="select CardNo,CardMoney from bankcard where  AccountId= $AccountId and CardNo != $CardNo";
//echo $sql;
//die;
//$result=allCardId($AccountId,$CardNo);
//print_r($result);
//die;
?>
<form action="date.php" method="post">
<table border="1" cellspacing="0" cellpadding="0" style="width: 500px;">
    <tr>
        <th><input type="checkbox" name="allCheck" id="allCheck" > </th>
        <th>卡号</th>
        <th>余额</th>
    </tr>

    <?
    $result=allCardId($AccountId,$CardNo);
    for($i=0;$i<count($result);$i++){


    ?>
    <tr>
        <td><input type="checkbox" name="check[]" value="<? echo $result[$i]['CardNo']?>"</td>
        <td name="values"><? echo $result[$i]['CardNo']?></td>
        <td><? echo $result[$i]['CardMoney']?></td>
    </tr>


<?php }
DbTools::close();
?>
<table/>
    <br>
    <input type="submit" value="注销"/>
</form>
<script type="text/javascript">
    var allchecked= document.getElementById('allCheck');
    var checked =document.getElementsByTagName('input');
    allchecked.onclick = function(){

        for (var i =0 ;i < checked.length;i++){
            checked[i].checked = this.checked;
        }
    }
</script>